package com.bsu.bsurokon.scene;

import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;

import com.bsu.bsurokon.BSURokon;
import com.bsu.bsurokon.GameTextures;
import com.bsu.bsurokon.modifier.ColorModifier;
import com.stickycoding.rokon.Scene;
import com.stickycoding.rokon.Sprite;
import com.stickycoding.rokon.background.FixedBackground;
 
public class GameScene extends Scene {
	public BSURokon game;
	private FixedBackground background;
	private Sprite boy;
	private ColorModifier modifier;
	public GameScene(BSURokon game){
		super(1,1);
		this.game = game;
		useInvoke();
		background = new FixedBackground(GameTextures.gameBack);
		setBackground(background);

		boy = new Sprite(100,100,GameTextures.robot.getWidth(),GameTextures.robot.getHeight());
		boy.setTexture(GameTextures.robot);
		add(0,boy);
		
		modifier = new ColorModifier();
	}
	
	 
	@Override
	public void onGameLoop() {
		// TODO Auto-generated method stub
		
	}

	public void onTouchDown(float x, float y,MotionEvent event,
			int pointerCount,int pointerId){
		Log.i("GameScene","onTouchDown()");
	}
	public void onTouchMove(float x, float y, MotionEvent event,   
	       int pointerCount, int pointerId) {   
	    boy.x = x - (GameTextures.robot.getWidth()/2);
	    boy.y = y - (GameTextures.robot.getHeight()/2);
	}   
	public void onTouchUp(float x, float y, MotionEvent event,   
	        int pointerCount, int pointerId) {   
	    boy.addModifier(modifier);
	}   
	public boolean onKeyDown(int keyCode, KeyEvent event) {   
	    switch (keyCode) {   
	    case KeyEvent.KEYCODE_CALL:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_CALL ");   
	        break;   
	    case KeyEvent.KEYCODE_BACK:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_BACK ");   
	        break;   
	    case KeyEvent.KEYCODE_SEARCH:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_SEARCH ");   
	        break;   
	    case KeyEvent.KEYCODE_MENU:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_MENU ");   
	        break;   
	    case KeyEvent.KEYCODE_ENDCALL:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_ENDCALL ");   
	        break;   
	    case KeyEvent.KEYCODE_HOME:   
	        Log.i("GameScene", "onKeyDown()   KEYCODE_HOME ");   
	        break;   
	    }   
	    return false;   
	}   


	@Override
	public void onPause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onReady() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onResume() {
		// TODO Auto-generated method stub
		
	}



}
